Skip to content

refactor(verifier): make TCB policy sources exhaustive - #950

Merged
kvinwang merged 1 commit into
masterfrom
codex/refactor-verifier-tcb-policy
Aug 5, 2026
Merged

refactor(verifier): make TCB policy sources exhaustive#950
kvinwang merged 1 commit into
masterfrom
codex/refactor-verifier-tcb-policy

Conversation

@kvinwang

@kvinwang kvinwang commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Problem

TCB policy source handling used a catch-all _ => match arm, so a newly added
DstackVerifiedReport variant would silently inherit another platform's trust
semantics instead of requiring an explicit decision.

Root cause and fix

Match all report variants exhaustively in policy_tcb_fields, so adding a
platform fails the build at this call site rather than defaulting into a
neighbouring platform's TCB surface.

Each arm now documents why it reads the source it does:

Platform TCB source Rationale
TDX report.status / report.advisory_ids Direct DCAP verdict.
GCP TDX tdx_report.* A TPM report is bundled alongside, but carries no TCB surface.
SEV-SNP tcb_info.tcb_status() Derived by comparing TCB versions, not read from a field.
AWS NitroTPM normalized to "UpToDate" No TDX/SNP-style TCB surface; matches the KMS bootAuth payload so the shared "UpToDate" auth gate passes.
Nitro Enclave empty No TCB surface, so a relying party's "UpToDate" requirement fails closed.

This is a behavior-preserving refactor. The previous _ => arm resolved through
DstackVerifiedReport::tdx_report(), which returns Some for TDX and GCP TDX
and None for Nitro Enclave; unwrap_or_default() then produced ("", [])
exactly what the explicit DstackNitroEnclave arm now returns.

Tests

Adds a decision table over constructed VerifiedAttestation values that
exercises policy_tcb_fields itself rather than an internal helper, because the
report-to-policy mapping is where a wrong source can silently downgrade the auth
gate. SEV-SNP is covered in both the matching (UpToDate) and mismatched
(OutOfDate) TCB-version shapes, since its status is computed rather than read.

Nitro Enclave is asserted separately for the opposite property: it must not
report "UpToDate", so an auth gate fails closed.

Each arm of the mapping was mutation-checked (GCP flattened to empty, Nitro
Enclave forged to "UpToDate", SNP hardcoded to "UpToDate", NitroTPM
emptied, TDX advisories dropped); all five mutations are caught by the table.

Scope

One logical verifier finding, one file: dstack/verifier/src/verification.rs.

Verification

  • cargo fmt --all -- --check: passed.
  • cargo clippy -p dstack-verifier --all-features -- -D warnings: passed.
  • cargo test -p dstack-verifier --all-features: 24 passed, 0 failed.
  • cargo check --workspace --all-features: passed. policy_tcb_fields keeps its
    signature, so the KMS caller in kms/src/main_service/upgrade_authority.rs is
    unaffected.

Copilot AI review requested due to automatic review settings July 31, 2026 03:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Base automatically changed from codex/refactor-verifier-image-strategies to master August 5, 2026 04:57
TCB policy source handling used a catch-all match arm, so a newly added
DstackVerifiedReport variant would silently inherit another platform's
trust semantics instead of requiring an explicit decision.

Match all report variants exhaustively in policy_tcb_fields so adding a
platform fails the build here, and document why each platform reads the
source it does: GCP has a bundled TPM report with no TCB surface, SNP
derives its status from TCB version comparison rather than a field, AWS
NitroTPM is normalized to "UpToDate" to match the KMS bootAuth payload,
and Nitro Enclave stays empty so an "UpToDate" gate fails closed.

Cover the mapping with a decision table over constructed attestations.
The table exercises policy_tcb_fields itself rather than a helper, since
the report-to-policy mapping is where a wrong source can silently
downgrade the auth gate.
@kvinwang
kvinwang force-pushed the codex/refactor-verifier-tcb-policy branch from 07bb2bb to 627b4a0 Compare August 5, 2026 13:11
@kvinwang kvinwang changed the title [STACKED on #937] refactor(verifier): make TCB policy sources exhaustive refactor(verifier): make TCB policy sources exhaustive Aug 5, 2026
@kvinwang
kvinwang merged commit ac9b9fd into master Aug 5, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants